<?php

/* 
 * Copyright (c) 2012 Aalto University and University of Helsinki
 * MIT License
 * see LICENSE.txt for more information
 */

require_once('config.inc');

$path = $_SERVER['PATH_INFO']; // esim. "/search"
$parts = explode('/', $path);

try {
  require_once('controller/RestController.php');

  $controller = new RestController();

  if (sizeof($parts) < 2 || $parts[1] == "") {
    header("Status: 404");
    echo("404 Not Found");
  } elseif ($parts[1] == 'search') {
    $controller->search();
  } elseif ($parts[1] == 'concept') {
    $controller->concept();
  } elseif ($parts[1] == 'data' && sizeof($parts) == 3) {
    var_dump($parts);
    $controller->data($parts[2]);
  } else {
    header("Status: 404");
    echo("404 Not Found");
  }
}

catch (Exception $e){
  die ('ERROR: ' . $e->getMessage());
}

?>
